Library:YSI\y zonepulse
Introduction The default gang zone system in SA:MP can display rectangles of colour on the map, and can make those rectangles flash on and off (indicating that a zone is under attack in the original single player game). y_zonepulse extends this flashing to incorporate multiple colours and slower fades between different colours. In the original version a zone was either a colour (say red) or invisible - no other options and no smooth transition between the two states. Now a zone can be one colour and slowly change in to another colour (and back), this other colour can of course be "invisible" but doesn't have to be. Examples Slowly pulse from Red to Green Pulse a zone from red to green and back. Changing from red to green takes one second, as does changing back from green to red. Jump back from Green to Red Pulse a zone from red to green, but then jump straight back to red. Changing from red to green takes one second, but going from green to red happens instantly. Fade to Green and wait This code will fade a zone from red to green, then stay green for five seconds before fading back to red. Note that the default value for delay2 (i.e. the amount of time to remain red) is the same as delay by default, but since we don't want to wait on red it needs to be explicitly set. Here the value is set to ZONE_PULSE_STAGE_TIME, which is the default time used in y_zonepulse for fades. Fading from red to green takes 1 second, as does fading back again. Fade to Green and stop y_zonepulse by default will pulse endlessly, but calling GangZoneStopPulseForX on a delay, after you know the colour has changed, but before it changes back, will appear to make the zone fade and stop. This can be done with a timer and long delay at the second colour: You could call [http://wiki.sa-mp.com/wiki/GangZoneShowForPlayer GangZoneShowForPlayer] in DoStop to ensure the correct colour is seen, but the timer is set to significantly longer than the fade time to ensure the transition is complete. Functions ZONE_PULSE_STAGE_TIME, time2 -1, delay2 -1) | | This function starts a gang zone fading from one colour to another. The first five parameters are required as they control what colours the zone fades between and how long the fading takes. The remaining parameters are optional and can adjust the effects of the zone (flashing, sawtooth, flickering etc).}} ZONE_PULSE_STAGE_TIME, time2 -1, delay2 -1) | | Exactly the same as GangZonePulseForPlayer, but misses off the first parameter and instead pulses the gang zone for all players. Note that if a new player connects after calling this function they will NOT see the zone pulsing.}} | This is the oposite function to GangZonePulseForPlayer, stopping the pulsing for that player instead of starting it. Note that this will leave the zone in whatever colour the pulse was up to, so calling [http://wiki.sa-mp.com/wiki/GangZoneShowForPlayer GangZoneShowForPlayer] straight afterwards to reset the colour is recommended.}} | Again, very similar to GangZoneStopPulseForPlayer but for all players connected to the server.}} Advanced y_zonepulse uses for its functions, rather than creating multiple versions of the same function. Both GangZonePulseForPlayer and GangZonePulseForAll are actually defined in terms of GangZonePulse, and the same for GangZoneStopPulse. These functions take some set of players and do the pulsing or stopping for that set. One player and all players are two possible sets, but other sets include groups and player arrays. See and for more information.